//
//  BVShopCartCell.m
//  BuyVegetables1
//
//  Created by 叶思超 on 15/10/26.
//  Copyright (c) 2015年 叶思超. All rights reserved.
//

#import "BVShopCartCell.h"
#import "BVShopsLeftCategoryDetail.h"
#import "BVShopCart.h"

@interface BVShopCartCell ()
/**
 *  名称
 */

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

/**
 *  价格
 */

@property (weak, nonatomic) IBOutlet UILabel *priceLabel;

/**
 *  商品数量
 */
@property (weak, nonatomic) IBOutlet UILabel *shopCountLabel;

@end

@implementation BVShopCartCell

- (void)awakeFromNib {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

+ (instancetype)cell {
    return [[[NSBundle mainBundle] loadNibNamed:@"BVShopCartCell" owner:nil options:nil] lastObject];
}

- (void)setShopsDetail:(BVShopsLeftCategoryDetail *)shopsDetail {
    _shopsDetail = shopsDetail;
    
    // 名称
    self.nameLabel.text = shopsDetail.title;
    
    // 价格
    self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f", [shopsDetail.each_bag_money floatValue] * [BVShopCart shopCartCounts:shopsDetail]];
    
    // 数量
    self.shopCountLabel.text = [NSString stringWithFormat:@"%ld", (long)[BVShopCart shopCartCounts:shopsDetail]];
}
@end
